<template>
  <el-menu-item :key="data.title" v-if="!data.children.length">{{data.title}}</el-menu-item>
  <el-submenu v-else>
    <template #title>{{data.title}}</template>
    <template v-for="(child, index) in data.children">
      <resub :data="child" :key="index"></resub>
    </template>
  </el-submenu>
</template>
<script>
import ElMenuItem from './el-menu-item.vue'
import ElSubmenu from './el-sub-menu.vue'
export default {
  name: "resub",
  props: {
    data: {}
  },
  mounted () {
    console.log(this.data.title);
  },
  components: {
    ElMenuItem,
    ElSubmenu
  }
}
</script>